1. Technical Field of the Invention
This invention relates to memory allocation and, more particularly, to a system and method for implementing counters in the primary memory of a computer system or telecommunications network.
2. Description of Related Art
Computer systems (or "the system") and telecommunications networks (or "the network") use memory to store information such as programs and data. Memory typically comprises secondary memory and primary (or main) memory. Secondary memory encompasses storage devices such as hard drives, tapes, and diskettes, and is more stable and less expensive per unit of storage than the Random Access Memory (RAM) of primary memory. Accordingly, secondary memory is favored for long-term data and program storage. Primary memory is mostly comprised of RAM, which is memory that directly stores information on computer chips. RAM usually stores a program or data only while that program is running or that data is needed. Then, once the user exits the program, or a program no longer needs the reserved data space, new information may "overwrite", or be stored in place of, the program or data once stored in RAM. In addition, if the computer is turned off, the information in the RAM is erased and is no longer exists. However, a computer system or telecommunications network can store and retrieve information in RAM much more quickly than it can store or retrieve data from secondary data devices, which means that programs run much more smoothly from RAM than from secondary memory. Thus, the executable code (which is the code in a program that controls the network or the system functions) of practically all programs is run from primary memory RAM. To simplify the remaining discussion, unless otherwise indicated, any reference to primary memory means the RAM of primary memory.
An operating system of a computer or a telecommunications network manages data transfers between the devices of a computer system or telecommunications network. One such data transfer moves the executable code of a software program to be run (or executed) from a secondary memory storage device to a portion of the primary memory available in a computer system or telecommunications network.
FIG. 1 is a graph of primary memory volume allocated as a function of time illustrating an attempt to load three programs 1-3 into primary memory over some undefined period of time. Primary memory is represented by the vertical axis and time is represented on the horizontal axis. As indicated by the Primary Memory Available line 4 on the graph, primary memory is generally a fixed resource, meaning that to increase primary memory additional primary memory must be purchased.
Typically, when allocating the primary memory, the operating system detects the amount of primary memory available and estimates the maximum amount of primary memory needed to run (as opposed to merely store) the executable code of the program. If adequate primary memory exists to run the executable code, the operating system allocates and reserves the appropriate amount of primary memory to insure that the program will run and then manages the loading of the executable code into primary memory.
Each new program loads while a previously loaded program is still running, that is to say, without exiting out of any previously loaded program. As long as the executable code of a first program located in its allocated primary memory is running, no other program can access or be assigned the primary memory space designated for that first program.
Because no other program can access or be assigned primary memory that is already allocated to another program which is still running, the allocation of primary memory by the operating system, as graphed in FIG. 1, takes the appearance of vertical steps as the first program 1 and then the second program 2 are loaded. However, if there is not enough primary memory available to run the executable program code of the third additional program 3, the operating system must either send an Ainsufficient memory@ error or dynamically use secondary memory to store a portion of the executable code, and load only some essential portion of the executable code into primary memory, which considerably slows down program execution. The diagonal lines of program 3 indicate that program 3 cannot be loaded because there is not adequate primary memory available.
In general, the executable code of a program comprises commands organized in groups of related code called blocks. Each block of code performs a specific function. One common block of code is called a counter.
U.S. Pat. No. 4,219,875 to Templeton (Templeton) discusses the operative steps required to implement generally accepted counting functions. A counter may automatically increment a number in storage, waiting until the stored number is incremented to a predetermined value to report that the predetermined value has been reached. Alternatively, the counter may report the number it is storing. Today, lines of software code replace the hardware devices of Templeton, but the required functional steps are the same.
FIG. 2 is a flow chart illustrating the steps of an existing counting function. First, an event is detected by the program in a detecting step 10. The program then, in a reporting step 12, reports the event to the designated counter for that event. The counter then increments the number it is storing in an incrementation step 14. In a storing step 16, the new value is saved to memory. Next, the counter executes a matching step 18 to see if the new number matches a predetermined value, if any. If the number matches the predetermined value, a report is made to the appropriate part of the program in a reporting step 20. If the number is less than the predetermined value, the program enters a waiting step 22 until the next event is detected, as in the detecting step 10. In contemporary systems every event being monitored uses a separate counter block in the code of a program.
Examples of using counters to monitor events are found in the telecommunications industry, and in particular, in radio telecommunications systems. For example, counters detect and prevent fraud in the telecommunications industry by monitoring the number of unsuccessful attempts at accessing an account, such as through the incorrect entry of a personal identification number (PIN). A large count of unsuccessful attempts at accessing an account could indicate an attempt to steal access to that account, thus warning the system operator to investigate the situation. Also in the telecommunications industry, counters monitor the number of calls made by customers in specific locations within specific time frames. With this information a system operator can formulate a marketing plan or create incentives to fill low use periods and decongest crowded periods.
Unfortunately, there is a substantial shortcoming with the current approach to monitoring events with counters. As applied to the telecommunications industry, existing systems use a separate counter in the software of each program to monitor each event for each system subscriber. Because a separate counter is implemented to monitor each event one wishes to track, the primary memory space allocated for counters in primary memory to run a modern telecommunications network program is substantial, often requiring millions of counters for a typical network. By way of illustration, monitoring just twenty events for fifty thousand subscribers requires that space for one million counters be allocated in memory, whether or not all twenty events are actually relevant for all of the users. In addition, the number of counters needed is estimated by industry experts to grow at least ten-fold in the near future, as the need for more and varied information grows.
Coping with large numbers of counters in each program is compounded by the large numbers of people subscribing for additional telecommunications services, such as cellular phone, data and facsimile lines. The proliferation of these devices has greatly increased the number of attempts by users to access telecommunications networks. As the number of user attempts to access the telecommunications network increases, more program space, and subsequently, more counters, attempt to load into primary memory. Should network demand exceed the amount of primary memory available, telecommunications systems operators are unable to count desired events.
One approach to dealing with the demands placed on primary memory is to physically increase the amount of primary memory available. However, this option is very expensive not only because of the high price of memory, but also because of the additional facility space, hardware, and support staff required to implement the additional primary memory. Running programs from secondary memory has also been suggested by Douglas Comer in his book Operating System Design, The Xinu Approach, but secondary memory access is slow and still requires additional facility space, hardware, and support staff.
While the foregoing discussion concerns the telecommunications industry, it is understood that the discussion is not so limited. Rather, it will be readily apparent that the discussion contemplates the problems encountered with storing executable code in primary memory used in other electronic media, such as computer systems.
In order to overcome the disadvantage of existing solutions, it would be advantageous to have a system and method of dynamically assigning counters to count different events in a computer system or telecommunications network. Such a system would increase the amount of primary system memory available to run additional programs and would do so without eliminating any functional aspects of a program. The present invention provides such a system.